#ifndef __MY_HF_POWER_H__
#define __MY_HF_POWER_H__

#include "n32l40x.h"
#include "my_gpio.h"

#define HF_OUTPUT_CTRL_PORT    GPIOB
#define HF_OUTPUT_CTRL_PIN     GPIO_PIN_10

#define HF_OUTPUT_ENABLE()     set_pin_high(HF_OUTPUT_CTRL_PORT, HF_OUTPUT_CTRL_PIN)
#define HF_OUTPUT_DISABLE()    set_pin_low(HF_OUTPUT_CTRL_PORT, HF_OUTPUT_CTRL_PIN)

#define HF_POWER_CTRL_PORT     GPIOB
#define HF_POWER_CTRL_PIN      GPIO_PIN_15
#define HF_POWER_ON()          set_pin_high(HF_POWER_CTRL_PORT, HF_POWER_CTRL_PIN)
#define HF_POWER_OFF()         set_pin_low(HF_POWER_CTRL_PORT, HF_POWER_CTRL_PIN)


// PWM 调节输出电压，该pwm占空比越低，输出电压越高
// time9 ---ch1---af1, 频率为25khz【避开人耳听到的范围】
#define HF_VOLTAGE_CTRL_PORT   GPIOB
#define HF_VOLTAGE_CTRL_PIN    GPIO_PIN_12


void hf_power_on(void);
void hf_power_off(void);
void hf_output_enable(void);
void hf_output_disable(void);

void hf_voltage_restar_duty(int duty);

void my_hf_power_init(void);

#endif